Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

N3DMovieCamera

Inherits From:	N3DCamera : View : Responder : Object

Declared In:	3Dkit/N3DCamera.h

Class Description

N3DMovieCamera is a subclass of N3DCamera for managing interactive and photorealistic animation.  N3DCamera provides methods for setting the first and last frame, counting frames, and playing a movie on-screen.  

In a 3D animation sequence, both the camera and the shapes can move.  N3DShape objects get the camera as the argument to their renderSelf: method.  They can then invoke the camera's frameNumber method to determine which frame is being rendered and position themselves appropriately for that frame.

To play a movie on-screen using the interactive renderer, invoke the displayMovie method.  This method plays the frames of the movie on-screen in sequence, beginning with the first frame, and ending with the last frame.  displayMovie will skip frames when playing the movie if its frame increment is set greater than 1.  Note that N3DMovieCamera doesn't provide a way to set the rate at which frames are displayed, or to synchronize movie display with other events.  

To create the frames of a movie with the PhotoRealistic RenderMan renderer, invoke the renderAsEPS or renderAsTIFF method.  For photorealistic rendering, an N3DMovieCamera must have a delegate that implements the camera:didRenderStream:tag:frameCount: method.  The delegate method should be able to accept the returned images in any sequence and perform the appropriate action with the images (for example, save each in an appropriately named file).  See N3DCamera for more description of these photorealistic rendering methods.  

Instance Variables

int frameNumber;

int startFrame;

int endFrame;

int frameIncrement;

frameNumber	 Current frame of camera's movie

startFrame	 First frame in movie

endFrame	 Last frame in movie

frameIncrement	 Amount to increment frameNumber between frames

Method Types

Initializing	- initFrame:

RenderMan drawing 	- render

Frame counters	- setFrameNumber:
- frameNumber
- setStartFrame:endFrame:incrementFramesBy:
- startFrame
- endFrame
- frameIncrement

Interactive display	- displayMovie

Rendering photorealistically	- renderAsEPS (N3DCamera)
- renderAsTIFF (N3DCamera) 
- cropInRects:nRects:
- getRect:forPage:

Setting up pages	- knowsPagesFirst:last:
- numCropWindows

Reading and writing	- read:
- write:
- awake

Instance Methods

awake

- awake

Performs additional initialization of the receiver after unarchiving.  Returns self.  

See also:  - read:, - write:

cropInRects:nRects:

- cropInRects:(NXRect *)theRects nRects:(int)rectCount

Returns self and, by reference in theRects, the bounds of the receiving N3DMovieCamera.   This method is overridden to prevent the kit from dividing the image into multiple rectangles when rendering on multiple rendering hostsÐinstead, a movie is rendered one frame per host.  

See also:  - numCropWindows

displayMovie

- displayMovie

Displays the frames in the movie beginning with the start frame and ending with the end frame by repeatedly invoking display on self.  If a frame increment was specified, skips that number of frames between each displayed frame.  See the class description for a more complete discussion of playing a movie.  Returns self.  

See also:  - render, -setStartFrame:endFrame:incrementFrameBy:

endFrame

- (int)endFrame

Returns the movie's last frame number.  By default, the last frame is set to 0.  

See also:  - frameIncrement, - frameNumber, - startFrame, - setFrameNumber, -setStartFrame:endFrame:incrementFrameBy:

frameIncrement

- (int)frameIncrement

Returns the amount by which the frame counter is incremented between frames when playing a movie.  By default, the frame increment is set to 1.

See also:  - frameNumber, - startFrame, - setFrameNumber:, -setStartFrame:endFrame:incrementFramesBy:

frameNumber

- (int)frameNumber

Returns the current frame number.  By default, the frame number is set to 0.  

See also:  - endFrame, - frameIncrement, - startFrame, - setFrameNumber:, -setStartFrame:endFrame:incrementFrameBy:

getRect:forPage:

- (BOOL)getRect:(NXRect *)theRect forPage:(int)thePage

Returns YES if thePage corresponds to one of the frames in the camera's movie.  Also returns, by reference in theRect, the camera's bounds.  This method, which is defined in View and invoked by the Application Kit when printing, is overridden by N3DMovieCamera to ensure that movies print correctly.

See also:  - knowsPagesFirst:last:

initFrame:

- initFrame:(const NXRect *)fRect

Initializes the receiver, a new instance of N3DMovieCamera.  Sets the frame number, start frame, and end frame to 0.  Sets the frame increment to 1.  Returns self.  

knowsPagesFirst:last:

- (BOOL)knowsPagesFirst:(int *)firstPage last:(int *)lastPage

Returns YES.  Also returns, by reference in firstPage and lastPage, the beginning and ending frame numbers for the movie.  Overridden to assure that an N3DMovieCamera can return a rectangle specifying the region that must be displayed to print a specific frame.  

See also:  - getRect:forPage:

numCropWindows

- (int)numCropWindows

Returns 1.   This method is overridden to prevent the 3D Graphics Kit from dividing the movie camera's image into multiple rectangles when performing photorealistic rendering on multiple hostsÐinstead, a movie is rendered one frame per host.  

See also:  - cropInRects:nRects:, - numSelectedHosts (N3DRenderPanel)

read:

- read:(NXTypedStream *)stream

Reads the receiver from stream.  Returns self.  

See also:  - write:, - awake

render

- render

If the receiver is printing, sets the frame number to the page number supplied by the Application's PrintInfo object and renders that frame.  Otherwise, renders the current frame number.  Returns self.  

See also:  - render (N3DCamera class)

setFrameNumber:

- setFrameNumber:(int)aFrameNumber

Sets the frame number.  Returns self.  

See also:  - endFrame, - frameIncrement, - frameNumber, - startFrame, -setStartFrame:endFrame:incrementFramesBy:

setStartFrame:endFrame:incrementFramesBy:

- setStartFrame:(int)start 
endFrame:(int)end 
incrementFramesBy:(int)skip

Sets the first and last frames in the movie.  Also sets the number of frames to skip between frames when playing the movie.  Returns self.  

See also:  - endFrame, - frameIncrement, - frameNumber, - startFrame, -setFrameNumber:

startFrame

- (int)startFrame

Returns the first frame of the movie.  

See also:  - endFrame, - frameIncrement, - frameNumber, - setFrameNumber, -setStartFrame:endFrame:incrementFrameBy:

write:

- write:(NXTypedStream *)stream

Writes the receiver to stream.  Returns self.  

See also:  - read:, - awake